package com.qianfeng.controller;

import com.qianfeng.entity.User;
import com.qianfeng.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@Controller
public class UserController {

    @Autowired
    private UserService service;

    @RequestMapping("/hello")
    public String hello(Integer id, Map map){
        System.out.println("success");
        User one = service.getOne(id);
        System.out.println(one);
        map.put("user",one);

        return "user";
    }

    @RequestMapping(value = "/hi",method = RequestMethod.DELETE)
    @ResponseBody
    public String hi(String name){

        System.out.println(name);

        return "hihihihihi";
    }



}
